using AutoMapper;
using Pay.DTO;
using Pay.Data;
using Pay.IService;

namespace Pay.Service.AutoMapper
{
    public class MerchantBankCardMapper : IStartupDto
    {
        private IMapperConfigurationExpression _cfg;
        public MerchantBankCardMapper(IMapperConfigurationExpression cfg)
        {
            _cfg = cfg;
        }
        public void Execute()
        {
            Create();
        }
        protected virtual void Create()
        {
            _cfg.CreateMap<MerchantBankCard, merchant_bank_card_dto>()
                .ForMember(dest => dest.id, src => src.MapFrom(c => c.Id))
                .ForMember(dest => dest.merchant_id, src => src.MapFrom(c => c.MerchantId))
                .ForMember(dest => dest.account_name, src => src.MapFrom(c => c.AccountName))
                .ForMember(dest => dest.account_num, src => src.MapFrom(c => c.AccountNum))
                .ForMember(dest => dest.bank_name, src => src.MapFrom(c => c.BankName))
                .ForMember(dest => dest.branch_name, src => src.MapFrom(c => c.BranchName))
                .ForMember(dest => dest.hand_id_card_img, src => src.MapFrom(c => c.HandIdCardImg))
                .ForMember(dest => dest.status, src => src.MapFrom(c => c.Status))
                .ForMember(dest => dest.remark, src => src.MapFrom(c => c.Remark))
                .ForMember(dest => dest.create_time, src => src.MapFrom(c => c.CreateTime))
                .ForMember(dest => dest.update_time, src => src.MapFrom(c => c.UpdateTime))
                .ForMember(dest => dest.audit_time, src => src.MapFrom(c => c.AuditTime))
                .ForMember(dest => dest.audit_user_id, src => src.MapFrom(c => c.AuditUserId))
                .ForMember(dest => dest.merchant, src => src.MapFrom(c => c.Merchant))
                .ForMember(dest => dest.audit_user, src => src.MapFrom(c => c.AuditUser));



            _cfg.CreateMap<merchant_bank_card_dto, MerchantBankCard>()
                .ForMember(dest => dest.Id, src => src.MapFrom(c => c.id))
                .ForMember(dest => dest.MerchantId, src => src.MapFrom(c => c.merchant_id))
                .ForMember(dest => dest.AccountName, src => src.MapFrom(c => c.account_name))
                .ForMember(dest => dest.AccountNum, src => src.MapFrom(c => c.account_num))
                .ForMember(dest => dest.BankName, src => src.MapFrom(c => c.bank_name))
                .ForMember(dest => dest.BranchName, src => src.MapFrom(c => c.branch_name))
                .ForMember(dest => dest.HandIdCardImg, src => src.MapFrom(c => c.hand_id_card_img))
                .ForMember(dest => dest.Status, src => src.MapFrom(c => c.status))
                .ForMember(dest => dest.Remark, src => src.MapFrom(c => c.remark))
                .ForMember(dest => dest.CreateTime, src => src.MapFrom(c => c.create_time))
                .ForMember(dest => dest.UpdateTime, src => src.MapFrom(c => c.update_time))
                .ForMember(dest => dest.AuditTime, src => src.MapFrom(c => c.audit_time))
                .ForMember(dest => dest.AuditUserId, src => src.MapFrom(c => c.audit_user_id));


            _cfg.CreateMap<MerchantBankCard, api_merchant_bank_card_dto>()
                .ForMember(dest => dest.id, src => src.MapFrom(c => c.Id))
                .ForMember(dest => dest.merchant_id, src => src.MapFrom(c => c.MerchantId))
                .ForMember(dest => dest.account_name, src => src.MapFrom(c => c.AccountName))
                .ForMember(dest => dest.account_num, src => src.MapFrom(c => c.AccountNum))
                .ForMember(dest => dest.bank_name, src => src.MapFrom(c => c.BankName))
                .ForMember(dest => dest.branch_name, src => src.MapFrom(c => c.BranchName))
                .ForMember(dest => dest.hand_id_card_img, src => src.MapFrom(c => c.HandIdCardImg))
                .ForMember(dest => dest.status, src => src.MapFrom(c => c.Status));


            _cfg.CreateMap<MerchantBankCard, merchant_bank_card_dto_ex>()
                .ForMember(dest => dest.id, src => src.MapFrom(c => c.Id))
                .ForMember(dest => dest.merchant_id, src => src.MapFrom(c => c.MerchantId))
                .ForMember(dest => dest.account_name, src => src.MapFrom(c => c.AccountName))
                .ForMember(dest => dest.account_num, src => src.MapFrom(c => c.AccountNum))
                .ForMember(dest => dest.bank_name, src => src.MapFrom(c => c.BankName))
                .ForMember(dest => dest.branch_name, src => src.MapFrom(c => c.BranchName))
                .ForMember(dest => dest.hand_id_card_img, src => src.MapFrom(c => c.HandIdCardImg))
                .ForMember(dest => dest.status, src => src.MapFrom(c => c.Status))
                .ForMember(dest => dest.remark, src => src.MapFrom(c => c.Remark))
                .ForMember(dest => dest.create_time, src => src.MapFrom(c => c.CreateTime))
                .ForMember(dest => dest.update_time, src => src.MapFrom(c => c.UpdateTime))
                .ForMember(dest => dest.audit_time, src => src.MapFrom(c => c.AuditTime))
                .ForMember(dest => dest.audit_user_id, src => src.MapFrom(c => c.AuditUserId))
                .ForMember(dest => dest.merchant, src => src.MapFrom(c => c.Merchant))
                .ForMember(dest => dest.audit_user, src => src.MapFrom(c => c.AuditUser));


        }
    }
}
